package com.sharefang.aproject.utils;


import com.sharefang.aproject.constant.CacheKey;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 检查工具类
 *
 * @author Lei 2016年7月26日13:26:34
 */

public class CheckUtil implements CacheKey {

    private CheckUtil() throws Exception {
        throw new Exception("不能创建本类的实例。");
    }

    public static boolean isLogined() {
        String logined = CacheHelper.getAsString(LOGINED);
        if (logined != null && logined.equals("true"))
            return true;
        return false;
    }

    public static boolean isFirstRun() {
        String runInfo = CacheHelper.getAsString(FIRST_RUN);
        if (runInfo != null && runInfo.equals("false"))
            return false;
        return true;
    }

    public static boolean isMobileNO(String mobiles) {
        Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
        Matcher m = p.matcher(mobiles);

        return m.matches();
    }
    public static boolean isNetWork(){
        return true;
    }
}
